
package com.zsrt.day0523.jdbc;

import java.io.FileInputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.Properties;

public class oracle01 {

	public static void main(String[] args) throws Exception{
		Properties prop = new Properties(); 
		FileInputStream in = new FileInputStream("resources/jdbc.oracle.properties");
		prop.load(in);
		
	   
		String className = prop.getProperty("jdbc.driver"); 
		
		Class.forName(className);
		
		String url = prop.getProperty("jdbc.url");
		String user=prop.getProperty("jdbc.user");
		String password=prop.getProperty("jdbc.password");
		Connection connection = DriverManager.getConnection(url, user, password);
		
		Statement statement = connection.createStatement();
		//String sql="insert into employee values(7151,22,7000,'jmj')";
		//int i = statement.executeUpdate(sql);
		//System.err.println(i);
		
		
		String sql1 = "select * from user_t";
		//查询
		ResultSet resultSet = statement.executeQuery(sql1 );
		int count = 0;
		 
		while (resultSet.next()){
			System.out.println(resultSet.getString("id")+"\t\t"+resultSet.getString("name")+"\t\t"+resultSet.getString("password")); 
		}
		
	}
}
